// index.js
// 获取应用实例
var app = getApp();

Page({
  data: {
    mode:'',
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
    canIUseGetUserProfile: false,
    canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName') ,// 如需尝试获取用户信息可改为false,
  },

  onLoad: function () {
   
    var userinfo= wx.getStorageSync('userinfo')
    var openid=wx.getStorageSync('openid')
    var that=this
    wx.request({
      url: app.globalData.api+'login?openid='+openid,
      success:function(res){
      if(res.data.data.userType==0){
       that.setData({
         mode:['管理员功能']
       })
      }
      wx.setStorageSync('user', res.data.data)
      }
    })
    this.setData({
      user_Info:userinfo
    })
   },
 vip(){
  wx.showModal({
    title: '提示',
    content:'请添加微信13039675307定制VIP服务',
    showCancel:false,
   
  })
  
 },
 address(){ 
   wx.navigateTo({
  url:'../my/address/address'
 })},
 weather(){
    wx.navigateTo({
     url:'../my/weather/weather'
    })
 },
 admin(){
  wx.navigateTo({
   url:'../my/admin/admin'
  })
},
getCart(){
  wx.navigateTo({
    url:'../tg/cart/cart'
  })
},

getorder(){
  wx.navigateTo({
    url:'../my/order/order'
   })
 
}
  

})
